/*
 ============================================================================
 Name		: YuebaoFavoriteCanvasMyGoodContentPanel.h
 Author	  : 
 Version	 : 1.0
 Copyright   :
 Description : MyGoodsContentPanel declaration
 ============================================================================
 */

#ifndef YUEBAOFAVORITECANVASMyGoodContentPanel_H
#define YUEBAOFAVORITECANVASMyGoodContentPanel_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include "YuebaoTabControl.h"
#include "fFramework.h"
#include "HttpEngine.h"
#include "fDialog.h"
#include "InputNumberDlg2.h"
#include "YuebaoShoppingTrolley.h"
#include "YuebaoFavoriteTabControl.h"
#include "YuebaoPayUtility.h"

// CLASS DECLARATION
class MyGoodsListboxContentControl;
class NetworkEngine;
class InputTranspasswordDlg;
/**
 *  MyGoodsContentPanel
 *
 */
class MyGoodsContentPanel : public fTabContentControl,
        public fTabControlObserver,
        public fListboxEventObserver,
        public HttpEngineObserver,
        public MDialogEventObserver
{
public:
    ~MyGoodsContentPanel( );
    static MyGoodsContentPanel *NewL( fEngine *aEngine, TRect rect );
    static MyGoodsContentPanel *NewLC( fEngine *aEngine, TRect rect );
private:
    MyGoodsContentPanel( );
    void ConstructL( fEngine *aEngine, TRect rect );
    void HandleNotPurchasedPanelKeyEvent( f_KEY_DES *& aKeyDes );
    void HandlePurchasedPanelKeyEnent( f_KEY_DES *aKeyDes );
public:
    virtual void TabChanged( int active_index, int deactive_index );
    virtual void TabNotHandleKeyEvent( f_KEY_DES * aKeyDes );

    virtual void Active( );
    virtual void Deactive( );

    virtual void GetFocused( );
    virtual void LostFocuse( );
public:
    virtual void RenderFrame( );
    virtual void HandleKey( f_KEY_DES * aKeyDes );
    TInt HandleMouse( fMouseEvent nType, TPoint sPoint );
private:
    void ReloadListbox();
    void UpdateToolbar();
protected:
    YuebaoFavoriteTabControl* _tabControl;
    MyGoodsListboxContentControl* _not_purchase_listbox;
    MyGoodsListboxContentControl* _purchase_listbox;
protected:
    void ListboxItemClicked( fListbox* pListBox, int selectIndex, fListBoxItem* pItemInfo );
protected:
    CHttpEngine* _httpEngine;
protected:
    //void HttpClientEvent( TInt aEventCode );
    //void HttpHeadReceived( const TDesC8& aHeadData );
    void HttpFinished( const CHttpEngine& engine, int finishedReason, const TDesC8& aBodyData );
    char* HttpEngineObserverID( )
        {
            return "goodscontent";
        }
protected:
    InputTranspasswordDlg* _dlgPassword;
    InputNumberDlg2* _dlgGoodsNumber;
protected:
    void HandleReturnEvent( fDialog* aObject, TReturnValue aValue );
public:
    fToolbar* _commandbar;
protected:
    YuebaoShoppingTrolley* _shoppingTrolley;

    int _dlgState;
private:
    YuebaoPayUtility* _payUtility;
};

#endif // YUEBAOFAVORITECANVASMyGoodContentPanel_H
